import request from '@/utils/request'
import http from './http.js'

// 登录方法
export function login(username, password, code, uuid) {
  const data = {
    username,
    password,
    code,
    uuid
  }
  return request({
    'url': '/login',
    headers: {
      isToken: false
    },
    'method': 'post',
    'data': data
  })
}

// 获取用户信息
export function getInfo() {
  return request({
    url: '/store/getInfo',
    method: 'GET'
  })
}

// 退出登录
export function logout() {
  return request({
    url: '/store/logout',
    method: 'post'
  })
}

// 获取验证码
// export function getCodeImg() {
//   return request({
//     'url': '/captchaImage',
//     headers: {
//       isToken: false
//     },
//     method: 'get',
//     timeout: 20000
//   })
// }

export const getCodeImg = (data) => http({
  url: '/captchaImage',
  method: 'GET',
  data
})

// 登录
export const clientLogin = (data) => {
  return request({
    url: '/store/login',
    headers: {
      isToken: false
    },
    method: 'POST',
    data
  })
}
